package com.example.wiki.controller;


import com.example.wiki.entity.resp.CommonResp;
import com.example.wiki.entity.resp.StatisticResp;
import com.example.wiki.service.IEbookSnapshotService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 电子书数据的快照 前端控制器
 * </p>
 *
 * @author jerry
 * @since 2024-10-08
 */
@RestController
@RequestMapping("/ebook-snapshot")
public class EbookSnapshotController {

    @Autowired
    private IEbookSnapshotService ebookSnapshotService;

    @GetMapping("/getStatistic")
    public CommonResp getStatistic(){
        CommonResp<List<StatisticResp>> resp = new CommonResp<>();
        List<StatisticResp> list = ebookSnapshotService.getStatistic();
        resp.setContent(list);
        return resp;
    }

    @GetMapping("/get30DayStatistic")
    public CommonResp get30DayStatistic(){
        CommonResp<List<StatisticResp>> resp = new CommonResp<>();
        List<StatisticResp> list = ebookSnapshotService.get30DayStatistic();
        resp.setContent(list);
        return resp;
    }

}
